import 'package:flutter/material.dart';
import 'package:flutter_uikit/widget/general_dialog/general_dialog_widget.dart';
import 'package:get/get.dart';

class GeneralDialogUtil {

  /// 显示通用对话框
  /// leftText: 标题
  /// subTitle: 副标题
  /// leftText: 左按钮文本
  /// rightText: 右按钮文本
  /// leftTextStyle: 左按钮文本样式
  /// rightTextStyle: 右按钮文本样式
  /// leftBgColor: 左按钮背景颜色
  /// rightBgColor: 右按钮背景颜色
  /// leftActionEvent: 左actionItem点击事件
  /// rightActionEvent: 右actionItem点击事件
  void showGeneralDialogWidget(String? title, String? subTitle,
      {String? leftText,
      String? rightText,
      TextStyle? leftTextStyle,
      TextStyle? rightTextStyle,
      Color? leftBgColor,
      Color? rightBgColor,
      Function()? leftActionEvent,
      Function()? rightActionEvent}) {
    Get.generalDialog(
        barrierDismissible: true,
        pageBuilder: (BuildContext context, Animation<double> animation,
            Animation<double> secondaryAnimation) {
          return Dialog(
              backgroundColor: Colors.transparent,
              child: GeneralDialogWidget(
                title,
                subTitle,
                leftText: leftText,
                rightText: rightText,
                leftTextStyle: leftTextStyle,
                rightTextStyle: rightTextStyle,
                leftBgColor: leftBgColor,
                rightBgColor: rightBgColor,
                leftActionEvent: leftActionEvent,
                rightActionEvent: rightActionEvent,
              ));
        },
        barrierLabel: '');
  }
}
